﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using FastColoredTextBoxNS;

namespace AngelSpellMaker
{
    public partial class UniWaveInstant860 : Form
    {
        string voc1;
        string voc2;
        string voc3;
        string voc4;

        public UniWaveInstant860()
        {
            InitializeComponent();            
        }
        /* MenuStrip Region */

        #region Menu Strip Region
        // New Spell
        private void clearFieldsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (TextBoxSpellName.Text != "" && TextBoxSpellWords.Text != "" && TextBoxLvlMin.Text != "" && TextBoxManaReque.Text != "" && TextBoxScript.Text != "" && TextBoxMinA.Text != "" && TextBoxMinB.Text != "" && TextBoxMaxA.Text != "" && TextBoxMaxB.Text != "" && SelectEffectBox.SelectedIndex != -1 && SelectDamageBox.SelectedIndex != -1 && SelectFormulaBox.SelectedIndex != -1)
            {                
                DialogResult result;
                result = MessageBox.Show("Sure, you want to clean all the fields?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    SorcererButton.Enabled = true;
                    DruidButton.Enabled = true;
                    PaladinButton.Enabled = true;
                    KnightButton.Enabled = true;
                    SyntaxTextBox.Clear();
                    TextBoxXML.Clear();
                    TextBoxSpellName.Clear();
                    TextBoxSpellWords.Clear();
                    TextBoxLvlMin.Clear();
                    TextBoxManaReque.Clear();
                    TextBoxScript.Clear();
                    TextBoxMinA.Clear();
                    TextBoxMinB.Clear();
                    TextBoxMaxA.Clear();
                    TextBoxMaxB.Clear();
                    MessageBox.Show("Clear the fields have been correctly", "Action Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Operation has been canceled", "Action Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("Clear the fields have been correctly", "Action Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
                SorcererButton.Enabled = true;
                DruidButton.Enabled = true;
                PaladinButton.Enabled = true;
                KnightButton.Enabled = true;
                SyntaxTextBox.Clear();
                TextBoxXML.Clear();
                TextBoxSpellName.Clear();
                TextBoxSpellWords.Clear();
                TextBoxLvlMin.Clear();
                TextBoxManaReque.Clear();
                TextBoxScript.Clear();
                TextBoxMinA.Clear();
                TextBoxMinB.Clear();
                TextBoxMaxA.Clear();
                TextBoxMaxB.Clear();
            }
        }
        // Save Spell
        private void saveSpellToolStripMenuItem_Click(object sender, EventArgs e)
        {
            String scriptspell = TextBoxScript.Text.ToString();
            SaveFileDialog saveFile1 = new SaveFileDialog();
            saveFile1.FileName = scriptspell;
            saveFile1.Filter = "Lua File|*.lua";
            if (saveFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK &&
               saveFile1.FileName.Length > 0)
            {                
                string ruta = saveFile1.FileName;
                StreamWriter fichero = new StreamWriter(ruta);
                fichero.Write(SyntaxTextBox.Text.ToString());
                fichero.Close();
            }
        }
        // Close ASM
        private void closeASMToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
        // Open Formula Calculator
        private void formulaCalculatorToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormulaCalculator formCalc = new FormulaCalculator();
            formCalc.Show();
        }
        // Check Upadtes
        private void updatesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("http://sourceforge.net/projects/angelspellmaker/");
        }
        // Open About Windows
        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AboutWin about = new AboutWin();
            about.Show();
        }
        #endregion

        /* MenuStrip Region End */

        #region Vocation Buttons
        private void SorcererButton_Click(object sender, EventArgs e)
        {
            voc1 = AngelSpellMaker.Properties.Resources.voc1;
            SorcererButton.Enabled = false;
        }

        private void DruidButton_Click(object sender, EventArgs e)
        {
            voc2 = AngelSpellMaker.Properties.Resources.voc2;
            DruidButton.Enabled = false;
        }

        private void PaladinButton_Click(object sender, EventArgs e)
        {
            voc3 = AngelSpellMaker.Properties.Resources.voc3;
            PaladinButton.Enabled = false;
        }

        private void KnightButton_Click(object sender, EventArgs e)
        {
            voc4 = AngelSpellMaker.Properties.Resources.voc4;
            KnightButton.Enabled = false;
        }
        #endregion

        public void MakeSpellButton_Click(object sender, EventArgs e)
        {
            // Area Region
            #region Variables de Combat Area
            int area1 = Convert.ToInt32(checkBox1.Checked);
            int area2 = Convert.ToInt32(checkBox2.Checked);
            int area3 = Convert.ToInt32(checkBox3.Checked);
            int area4 = Convert.ToInt32(checkBox4.Checked);
            int area5 = Convert.ToInt32(checkBox5.Checked);
            int area6 = Convert.ToInt32(checkBox6.Checked);
            int area7 = Convert.ToInt32(checkBox7.Checked);
            int area8 = Convert.ToInt32(checkBox8.Checked);
            int area9 = Convert.ToInt32(checkBox9.Checked);
            int area10 = Convert.ToInt32(checkBox10.Checked);
            int area11 = Convert.ToInt32(checkBox11.Checked);
            int area12 = Convert.ToInt32(checkBox12.Checked);
            int area13 = Convert.ToInt32(checkBox13.Checked);
            int area14 = Convert.ToInt32(checkBox14.Checked);
            int area15 = Convert.ToInt32(checkBox15.Checked);
            int area16 = Convert.ToInt32(checkBox16.Checked);
            int area17 = Convert.ToInt32(checkBox17.Checked);
            int area18 = Convert.ToInt32(checkBox18.Checked);
            int area19 = Convert.ToInt32(checkBox19.Checked);
            int area20 = Convert.ToInt32(checkBox20.Checked);
            int area21 = Convert.ToInt32(checkBox21.Checked);
            int area22 = Convert.ToInt32(checkBox22.Checked);
            int area23 = Convert.ToInt32(checkBox23.Checked);
            int area24 = Convert.ToInt32(checkBox24.Checked);
            int area25 = Convert.ToInt32(checkBox25.Checked);
            int area26 = Convert.ToInt32(checkBox26.Checked);
            int area27 = Convert.ToInt32(checkBox27.Checked);
            int area28 = Convert.ToInt32(checkBox28.Checked);
            int area29 = Convert.ToInt32(checkBox29.Checked);
            int area30 = Convert.ToInt32(checkBox30.Checked);
            int area31 = Convert.ToInt32(checkBox31.Checked);
            int area32 = Convert.ToInt32(checkBox32.Checked);
            int area33 = Convert.ToInt32(checkBox33.Checked);
            int area34 = Convert.ToInt32(checkBox34.Checked);
            int area35 = Convert.ToInt32(checkBox35.Checked);
            int area36 = Convert.ToInt32(checkBox36.Checked);
            int area37 = Convert.ToInt32(checkBox37.Checked);
            int area38 = Convert.ToInt32(checkBox38.Checked);
            int area39 = Convert.ToInt32(checkBox39.Checked);
            int area40 = Convert.ToInt32(checkBox40.Checked);
            int area41 = Convert.ToInt32(checkBox41.Checked);
            int area42 = Convert.ToInt32(checkBox42.Checked);
            int area43 = Convert.ToInt32(checkBox43.Checked);
            int area44 = Convert.ToInt32(checkBox44.Checked);
            int area45 = Convert.ToInt32(checkBox45.Checked);
            int area46 = Convert.ToInt32(checkBox46.Checked);
            int area47 = Convert.ToInt32(checkBox47.Checked);
            int area48 = Convert.ToInt32(checkBox48.Checked);
            int area49 = Convert.ToInt32(checkBox49.Checked);
            int area50 = Convert.ToInt32(checkBox50.Checked);
            int area51 = Convert.ToInt32(checkBox51.Checked);
            int area52 = Convert.ToInt32(checkBox52.Checked);
            int area53 = Convert.ToInt32(checkBox53.Checked);
            int area54 = Convert.ToInt32(checkBox54.Checked);
            int area55 = Convert.ToInt32(checkBox55.Checked);
            int area56 = Convert.ToInt32(checkBox56.Checked);
            int area57 = Convert.ToInt32(checkBox57.Checked);
            int area58 = Convert.ToInt32(checkBox58.Checked);
            int area59 = Convert.ToInt32(checkBox59.Checked);
            int area60 = Convert.ToInt32(checkBox60.Checked);
            int area61 = 2;
            int area62 = Convert.ToInt32(checkBox62.Checked);
            int area63 = Convert.ToInt32(checkBox63.Checked);
            int area64 = Convert.ToInt32(checkBox64.Checked);
            int area65 = Convert.ToInt32(checkBox65.Checked);
            int area66 = Convert.ToInt32(checkBox66.Checked);
            int area67 = Convert.ToInt32(checkBox67.Checked);
            int area68 = Convert.ToInt32(checkBox68.Checked);
            int area69 = Convert.ToInt32(checkBox69.Checked);
            int area70 = Convert.ToInt32(checkBox70.Checked);
            int area71 = Convert.ToInt32(checkBox71.Checked);
            int area72 = Convert.ToInt32(checkBox72.Checked);
            int area73 = Convert.ToInt32(checkBox73.Checked);
            int area74 = Convert.ToInt32(checkBox74.Checked);
            int area75 = Convert.ToInt32(checkBox75.Checked);
            int area76 = Convert.ToInt32(checkBox76.Checked);
            int area77 = Convert.ToInt32(checkBox77.Checked);
            int area78 = Convert.ToInt32(checkBox78.Checked);
            int area79 = Convert.ToInt32(checkBox79.Checked);
            int area80 = Convert.ToInt32(checkBox80.Checked);
            int area81 = Convert.ToInt32(checkBox81.Checked);
            int area82 = Convert.ToInt32(checkBox82.Checked);
            int area83 = Convert.ToInt32(checkBox83.Checked);
            int area84 = Convert.ToInt32(checkBox84.Checked);
            int area85 = Convert.ToInt32(checkBox85.Checked);
            int area86 = Convert.ToInt32(checkBox86.Checked);
            int area87 = Convert.ToInt32(checkBox87.Checked);
            int area88 = Convert.ToInt32(checkBox88.Checked);
            int area89 = Convert.ToInt32(checkBox89.Checked);
            int area90 = Convert.ToInt32(checkBox90.Checked);
            int area91 = Convert.ToInt32(checkBox91.Checked);
            int area92 = Convert.ToInt32(checkBox92.Checked);
            int area93 = Convert.ToInt32(checkBox93.Checked);
            int area94 = Convert.ToInt32(checkBox94.Checked);
            int area95 = Convert.ToInt32(checkBox95.Checked);
            int area96 = Convert.ToInt32(checkBox96.Checked);
            int area97 = Convert.ToInt32(checkBox97.Checked);
            int area98 = Convert.ToInt32(checkBox98.Checked);
            int area99 = Convert.ToInt32(checkBox99.Checked);
            int area100 = Convert.ToInt32(checkBox100.Checked);
            int area101 = Convert.ToInt32(checkBox101.Checked);
            int area102 = Convert.ToInt32(checkBox102.Checked);
            int area103 = Convert.ToInt32(checkBox103.Checked);
            int area104 = Convert.ToInt32(checkBox104.Checked);
            int area105 = Convert.ToInt32(checkBox105.Checked);
            int area106 = Convert.ToInt32(checkBox106.Checked);
            int area107 = Convert.ToInt32(checkBox107.Checked);
            int area108 = Convert.ToInt32(checkBox108.Checked);
            int area109 = Convert.ToInt32(checkBox109.Checked);
            int area110 = Convert.ToInt32(checkBox110.Checked);
            int area111 = Convert.ToInt32(checkBox111.Checked);
            int area112 = Convert.ToInt32(checkBox112.Checked);
            int area113 = Convert.ToInt32(checkBox113.Checked);
            int area114 = Convert.ToInt32(checkBox114.Checked);
            int area115 = Convert.ToInt32(checkBox115.Checked);
            int area116 = Convert.ToInt32(checkBox116.Checked);
            int area117 = Convert.ToInt32(checkBox117.Checked);
            int area118 = Convert.ToInt32(checkBox118.Checked);
            int area119 = Convert.ToInt32(checkBox119.Checked);
            int area120 = Convert.ToInt32(checkBox120.Checked);
            int area121 = Convert.ToInt32(checkBox121.Checked);
            #endregion

            // Variable Area Combat
            string spellarea = "{" + area1 + ", " + area12 + ", " + area23 + ", " + area34 + ", " + area45 + ", " + area56 + ", " + area67 + ", " + area78 + ", " + area89 + ", " + area100 + ", " + area111 + "},\n{" + area2 + ", " + area13 + ", " + area24 + ", " + area35 + ", " + area46 + ", " + area57 + ", " + area68 + ", " + area79 + ", " + area90 + ", " + area101 + ", " + area112 + "},\n{" + area3 + ", " + area14 + ", " + area25 + ", " + area36 + ", " + area47 + ", " + area58 + ", " + area69 + ", " + area80 + ", " + area91 + ", " + area102 + ", " + area113 + "},\n{" + area4 + ", " + area15 + ", " + area26 + ", " + area37 + ", " + area48 + ", " + area59 + ", " + area70 + ", " + area81 + ", " + area92 + ", " + area103 + ", " + area114 + "},\n{" + area5 + ", " + area16 + ", " + area27 + ", " + area38 + ", " + area49 + ", " + area60 + ", " + area71 + ", " + area82 + ", " + area93 + ", " + area104 + ", " + area115 + "},\n{" + area6 + ", " + area17 + ", " + area28 + ", " + area39 + ", " + area50 + ", " + area61 + ", " + area72 + ", " + area83 + ", " + area94 + ", " + area105 + ", " + area116 + "},\n{" + area7 + ", " + area18 + ", " + area29 + ", " + area30 + ", " + area51 + ", " + area62 + ", " + area73 + ", " + area84 + ", " + area95 + ", " + area106 + ", " + area117 + "},\n{" + area8 + ", " + area19 + ", " + area30 + ", " + area41 + ", " + area52 + ", " + area63 + ", " + area74 + ", " + area85 + ", " + area96 + ", " + area107 + ", " + area118 + "},\n{" + area9 + ", " + area20 + ", " + area31 + ", " + area42 + ", " + area53 + ", " + area64 + ", " + area75 + ", " + area86 + ", " + area97 + ", " + area108 + ", " + area119 + "},\n{" + area10 + ", " + area21 + ", " + area32 + ", " + area43 + ", " + area54 + ", " + area65 + ", " + area76 + ", " + area87 + ", " + area98 + ", " + area109 + ", " + area120 + "},\n{" + area11 + ", " + area22 + ", " + area33 + ", " + area44 + ", " + area55 + ", " + area66 + ", " + area77 + ", " + area88 + ", " + area99 + ", " + area110 + ", " + area121 + "},";

            // Variables de Configuracion de la Spell            
            #region Variables Config XML
            string namespell = TextBoxSpellName.Text;
            string wordspell = TextBoxSpellWords.Text;
            string lvlspell = TextBoxLvlMin.Text;
            string manaspell = TextBoxManaReque.Text;
            string scriptspell = TextBoxScript.Text;
            #endregion

            #region Variables Config Script Spell
            string spelltype = SelectDamageBox.Text.ToString();
            string spelleffect = SelectEffectBox.Text.ToString();
            string spellformula = SelectFormulaBox.Text.ToString();
            string minA = TextBoxMinA.Text;
            string minB = TextBoxMinB.Text;
            string maxA = TextBoxMaxA.Text;
            string maxB = TextBoxMaxB.Text;
            #endregion

            // Variables Main
            string xmlline = "<instant name=\"" + namespell + "\" words=\"" + wordspell + "\" lvl=\"" + lvlspell + "\" mana=\"" + manaspell + "\" aggressive=\"1\" exhaustion=\"2000\" needlearn=\"0\" event=\"script\" value=\"" + scriptspell + ".lua\">";
            string spellscript = "-- Spell Creada en Angel Spell's Maker ---\n-- Borrar estas 3 Lineas, hace violacion a los derechos acordados en Creative Commons --\n-- Angel Spell's Maker creador por DJ Death --\nlocal combat1 = createCombatObject()\nsetCombatParam(combat1, COMBAT_PARAM_TYPE, " + spelltype + ")\nsetCombatParam(combat1, COMBAT_PARAM_EFFECT, " + spelleffect + ")\nsetCombatFormula(combat1, " + spellformula + ", -" + minA + ", -" + minB + ", -" + maxA + ", -" + maxB + ")\n\narr1 = {\n" + spellarea + "\n}\n\nlocal area1 = createCombatArea(arr1)\nsetCombatArea(combat1, area1)\n\nlocal function onCastSpell1(parameters)\ndoCombat(parameters.cid, combat1, parameters.var)\n\nend\n\nfunction onCastSpell(cid, var)\nlocal parameters = { cid = cid, var = var}\naddEvent(onCastSpell1, 100, parameters)\nend";
            
            //funcion Main
            if (TextBoxSpellName.Text != "" && TextBoxSpellWords.Text != "" && TextBoxLvlMin.Text != "" && TextBoxManaReque.Text != "" && TextBoxScript.Text != "" && TextBoxMinA.Text != "" && TextBoxMinB.Text != "" && TextBoxMaxA.Text != "" && TextBoxMaxB.Text != "" && SelectEffectBox.SelectedIndex != -1 && SelectDamageBox.SelectedIndex != -1 && SelectFormulaBox.SelectedIndex != -1)
            {
                MessageBox.Show("Script has been created of Spell Correctly.\nGo to the Script tab.\n Angel Spell Maker Created by DJ Death.", "Action Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
                SyntaxTextBox.Clear();
                TextBoxXML.AppendText(xmlline + voc1 + voc2 + voc3 + voc4 + "</instant>");
                SyntaxTextBox.AppendText(spellscript);
                // Funciones de New
                SorcererButton.Enabled = true;
                DruidButton.Enabled = true;
                PaladinButton.Enabled = true;
                KnightButton.Enabled = true;
            }
            else
            {
                MessageBox.Show("Complete text fields on the tab configuration", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        #region ComboBox Change Imagen
        private void SelectEffectBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string a = SelectEffectBox.Text;
                switch (a)
                {
                    case "CONST_ME_DRAWBLOOD":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z0;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: DrawBlood");
                        break;

                    case "CONST_ME_LOSEENERGY":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z1;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Lose Energy");
                        break;

                    case "CONST_ME_POFF":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z2;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Poff");
                        break;

                    case "CONST_ME_BLOCKHIT":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z3;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Block Hit");
                        break;

                    case "CONST_ME_EXPLOSIONAREA":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z4;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Explosion Area");
                        break;

                    case "CONST_ME_EXPLOSIONHIT":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z5;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Explosion Hit");
                        break;

                    case "CONST_ME_FIREAREA":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z6;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Fire Area");
                        break;

                    case "CONST_ME_YELLOW_RINGS":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z7;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Yellow Rings");
                        break;

                    case "CONST_ME_GREEN_RINGS":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z8;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Green Rings");
                        break;

                    case "CONST_ME_HITAREA":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z9;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Hit Area");
                        break;

                    case "CONST_ME_TELEPORT":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z10;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Teleport");
                        break;

                    case "CONST_ME_ENERGYHIT":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z11;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Energy Hit");
                        break;

                    case "CONST_ME_MAGIC_BLUE":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z12;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Magic Blue");
                        break;

                    case "CONST_ME_MAGIC_RED":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z13;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Magic Red");
                        break;

                    case "CONST_ME_MAGIC_GREEN":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z14;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Magic Green");
                        break;

                    case "CONST_ME_HITBYFIRE":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z15;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Fire Hit");
                        break;

                    case "CONST_ME_HITBYPOISON":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z16;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Poison Hit");
                        break;

                    case "CONST_ME_MORTAREA":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z17;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Mort Area");
                        break;

                    case "CONST_ME_SOUND_GREEN":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z18;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Sound Green");
                        break;

                    case "CONST_ME_SOUND_RED":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z19;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Sound Red");
                        break;

                    case "CONST_ME_POISONAREA":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z20;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Poison Area");
                        break;

                    case "CONST_ME_SOUND_YELLOW":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z21;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Sound Yellow");
                        break;

                    case "CONST_ME_SOUND_PURPLE":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z22;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Sound Purple");
                        break;

                    case "CONST_ME_SOUND_BLUE":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z23;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Sound Blue");
                        break;

                    case "CONST_ME_SOUND_WHITE":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z24;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Sound White");
                        break;

                    case "CONST_ME_BUBBLES":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z25;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Bubbles");
                        break;

                    case "CONST_ME_CRAPS":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z26;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Craps");
                        break;

                    case "CONST_ME_GIFT_WRAPS":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z27;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Gift Wraps");
                        break;

                    case "CONST_ME_FIREWORK_YELLOW":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z28;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Firework Yellow");
                        break;
                    // configurar otros 10 D: para las 34
                    case "CONST_ME_FIREWORK_RED":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z29;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Firework Red");
                        break;

                    case "CONST_ME_FIREWORK_BLUE":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z30;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Firework Blue");
                        break;

                    case "CONST_ME_STUN":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z31;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Stun");
                        break;

                    case "CONST_ME_SLEEP":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z32;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Sleep");
                        break;

                    case "CONST_ME_WATERCREATURE":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z33;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Water Creature");
                        break;

                    case "CONST_ME_GROUNDSHAKER":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z34;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Ground Shaker");
                        break;

                    case "CONST_ME_HEARTS":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z35;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Heart");
                        break;

                    case "CONST_ME_FIREATTACK":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z36;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Fire Attack");
                        break;

                    case "CONST_ME_ENERGYAREA":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z37;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Energy Area");
                        break;

                    case "CONST_ME_SMALLCLOUDS":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z38;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Small Clouds");
                        break;

                    case "CONST_ME_HOLYDAMAGE":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z39;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Holy Damage");
                        break;

                    case "CONST_ME_BIGCLOUDS":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z40;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Big Clouds");
                        break;

                    case "CONST_ME_ICEAREA":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z41;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Ice Area");
                        break;

                    case "CONST_ME_ICETORNADO":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z42;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Ice Tornado");
                        break;

                    case "CONST_ME_ICEATTACK":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z43;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Ice Attack");
                        break;

                    case "CONST_ME_STONES":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z44;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Stones");
                        break;

                    case "CONST_ME_SMALLPLANTS":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z45;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Small Plants");
                        break;

                    case "CONST_ME_CARNIPHILA":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z46;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Carniphila");
                        break;
                    // xd
                    case "CONST_ME_PURPLEENERGY":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z47;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Purple Energy");
                        break;

                    case "CONST_ME_YELLOWENERGY":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z48;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Yellow Energy");
                        break;

                    case "CONST_ME_HOLYAREA":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z49;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Holy Area");
                        break;

                    case "CONST_ME_BIGPLANTS":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z50;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Big Plants");
                        break;

                    case "CONST_ME_CAKE":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z51;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Cake");
                        break;

                    case "CONST_ME_GIANTICE":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z52;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Giant Ice");
                        break;

                    case "CONST_ME_WATERSPLASH":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z53;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Whater Splash");
                        break;

                    case "CONST_ME_PLANTATTACK":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z54;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Plant Attack");
                        break;

                    case "CONST_ME_TUTORIALARROW":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z55;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Tutorial Arrow");
                        break;

                    case "CONST_ME_TUTORIALSQUARE":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z56;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Tutorial Square");
                        break;

                    case "CONST_ME_MIRRORHORIZONTAL":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z57;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Mirror Horizontal");
                        break;

                    case "CONST_ME_MIRRORVERTICAL":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z58;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Mirror Vertical");
                        break;

                    case "CONST_ME_SKULLHORIZONTAL":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z59;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Skull Horizontal");
                        break;

                    case "CONST_ME_SKULLVERTICAL":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z60;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Skull Vertical");
                        break;

                    case "CONST_ME_ASSASSIN":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z61;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Assassin");
                        break;

                    case "CONST_ME_STEPSHORIZONTAL":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z62;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Steps Horizontal");
                        break;

                    case "CONST_ME_BLOODYSTEPS":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z63;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Blood Steps");
                        break;

                    case "CONST_ME_STEPSVERTICAL":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z64;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Steps Vertical");
                        break;

                    case "CONST_ME_YALAHARIGHOST":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z65;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Yalaharia Ghost");
                        break;

                    case "CONST_ME_BATS":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z66;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Bats");
                        break;

                    case "CONST_ME_SMOKE":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z67;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Smoke");
                        break;

                    case "CONST_ME_INSECTS":
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.z68;
                        InfoTooTip.SetToolTip(this.ImageEffect, "Effect Selected: Insect");
                        break;

                    default:
                        ImageEffect.Image = AngelSpellMaker.Properties.Resources.noimage;
                        break;
                }
            }
            catch (System.IO.FileNotFoundException)
            {
                MessageBox.Show("Image Not Found", "Internal Error");
            }
        }        

        private void SelectDamageBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string c = SelectDamageBox.Text;
                switch (c)
                {
                    case "COMBAT_NONE":
                        ImageDamage.Image = AngelSpellMaker.Properties.Resources.none;
                        InfoTooTip.SetToolTip(this.ImageDamage, "Damage Selected: None");
                        break;

                    case "COMBAT_PHYSICALDAMAGE":
                        ImageDamage.Image = AngelSpellMaker.Properties.Resources.physical;
                        InfoTooTip.SetToolTip(this.ImageDamage, "Damage Selected: Physical");
                        break;

                    case "COMBAT_ENERGYDAMAGE":
                        ImageDamage.Image = AngelSpellMaker.Properties.Resources.energy;
                        InfoTooTip.SetToolTip(this.ImageDamage, "Damage Selected: Energy");
                        break;

                    case "COMBAT_EARTHDAMAGE":
                        ImageDamage.Image = AngelSpellMaker.Properties.Resources.earth;
                        InfoTooTip.SetToolTip(this.ImageDamage, "Damage Selected: Earth");
                        break;

                    case "COMBAT_POISONDAMAGE":
                        ImageDamage.Image = AngelSpellMaker.Properties.Resources.poison;
                        InfoTooTip.SetToolTip(this.ImageDamage, "Damage Selected: Poison");
                        break;

                    case "COMBAT_FIREDAMAGE":
                        ImageDamage.Image = AngelSpellMaker.Properties.Resources.fire;
                        InfoTooTip.SetToolTip(this.ImageDamage, "Damage Selected: Fire");
                        break;

                    case "COMBAT_UNDEFINEDDAMAGE":
                        ImageDamage.Image = AngelSpellMaker.Properties.Resources.cundefined;
                        InfoTooTip.SetToolTip(this.ImageDamage, "Damage Selected: Undefined");
                        break;

                    case "COMBAT_LIFEDRAIN":
                        ImageDamage.Image = AngelSpellMaker.Properties.Resources.lifedrain;
                        InfoTooTip.SetToolTip(this.ImageDamage, "Damage Selected: Life Drain");
                        break;

                    case "COMBAT_MANADRAIN":
                        ImageDamage.Image = AngelSpellMaker.Properties.Resources.manadrain;
                        InfoTooTip.SetToolTip(this.ImageDamage, "Damage Selected: Mana Drain");
                        break;

                    case "COMBAT_HEALING":
                        ImageDamage.Image = AngelSpellMaker.Properties.Resources.heal;
                        InfoTooTip.SetToolTip(this.ImageDamage, "Damage Selected: Healing");
                        break;

                    case "COMBAT_DROWNDAMAGE":
                        ImageDamage.Image = AngelSpellMaker.Properties.Resources.drown;
                        InfoTooTip.SetToolTip(this.ImageDamage, "Damage Selected: Drown");
                        break;

                    case "COMBAT_ICEDAMAGE":
                        ImageDamage.Image = AngelSpellMaker.Properties.Resources.ice;
                        InfoTooTip.SetToolTip(this.ImageDamage, "Damage Selected: Ice");
                        break;

                    case "COMBAT_HOLYDAMAGE":
                        ImageDamage.Image = AngelSpellMaker.Properties.Resources.holy;
                        InfoTooTip.SetToolTip(this.ImageDamage, "Damage Selected: Holy");
                        break;

                    case "COMBAT_DEATHDAMAGE":
                        ImageDamage.Image = AngelSpellMaker.Properties.Resources.death;
                        InfoTooTip.SetToolTip(this.ImageDamage, "Damage Selected: Death");
                        break;

                    default:
                        ImageDamage.Image = AngelSpellMaker.Properties.Resources.noimage;
                        InfoTooTip.SetToolTip(this.ImageDamage, "Damage preview image is selected");
                        break;
                }
            }
            catch (System.IO.FileNotFoundException)
            {
                MessageBox.Show("Image Not Found", "Internal Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

        }
        #endregion

        private void ButtonFC_Click(object sender, EventArgs e)
        {
            FormulaCalculator openthis = new FormulaCalculator();
            openthis.Show();
        }

    }
}
